var canvas = document.createElement("canvas")
var img = canvas.toDataURL('./01.jpg') // base64

function dataURItoBlob(dataURI) {//图片转成Buffer   
  var byteString = atob(dataURI.split(',')[1])
  var mimeString = dataURI.split(',')[0].split(':')[1].split(';')[0]
  var ab = new ArrayBuffer(byteString.length)
  var ia = new Uint8Array(ab)
  for (var i = 0; i < byteString.length; i++) {
      ia[i] = byteString.charCodeAt(i)
  }
  return new Blob([ab], {type: mimeString})
}

var blob = dataURItoBlob(img)

// 转化成file
var file = new File([blob], 'lee')
console.log(file)

var formData = new FormData()
formData.append('file', file)
console.log(formData.get("file"))
// 提交formData
ajax(formData)
 

function ajax() { }